package com.tianji.learning.questionTest;

import com.tianji.learning.domain.po.InteractionQuestion;
import com.tianji.learning.service.InteractionQuestionService;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.ComponentScan;

import java.util.List;

@ComponentScan("com.tianji.learning")
public class questiontest {
    @Autowired
    InteractionQuestionService interactionQuestionService;
    @Test
    public void test1(){
        Long courseId = 2L;
        Long sectionId = 15L;
        List<InteractionQuestion> description = interactionQuestionService.lambdaQuery()
                .select(InteractionQuestion.class, tableFieldInfo -> !tableFieldInfo.getProperty().equals("description"))//不查询description字段
                .eq(InteractionQuestion::getUserId, 2)//查询自己的问题
                .eq(InteractionQuestion::getHidden, false)//管理员是否隐藏
                .eq(InteractionQuestion::getCourseId, courseId)
                .eq(InteractionQuestion::getSectionId, sectionId)
                .list();
        System.out.println(description);
    }
}
